package me.chan.helper;

import me.chan.constant.ConfigConstant;
import me.chan.util.PropertiesUtil;

import java.util.Properties;

/**
 * Created by Administrator on 2017/6/12.
 */
public class ConfigHelper {

    private static final String DEFAULT_APP_STATIC_PATH = "/static/";

    private static final String DEFAULT_JSP_PATH = "/WEB-INF/view";

    private static final Properties CONFIG_PROPS = PropertiesUtil.loadProperties(ConfigConstant.CONFIGURATE_FILE);

    public static String getMysqlJdbcDriver(){
        return PropertiesUtil.getStringProperty(CONFIG_PROPS, ConfigConstant.MYSQL_JDBC_DRIVER);
    }

    public static String getMysqlJdbcUrl() {
        return PropertiesUtil.getStringProperty(CONFIG_PROPS, ConfigConstant.MYSQL_JDBC_URL);
    }

    public static String getMysqlJdbcUsername() {
        return PropertiesUtil.getStringProperty(CONFIG_PROPS, ConfigConstant.MYSQL_JDBC_USERNAME);
    }

    public static String getMysqlJdbcPassword() {
        return PropertiesUtil.getStringProperty(CONFIG_PROPS, ConfigConstant.MYSQL_JDBC_PASSWORD);
    }

    public static String getAppJspPath() {
        return PropertiesUtil.getStringProperty(CONFIG_PROPS, ConfigConstant.APP_JSP_PATH, DEFAULT_JSP_PATH);
    }

    public static String getAppStaticPath() {
        return PropertiesUtil.getStringProperty(CONFIG_PROPS, ConfigConstant.APP_STATIC_PATH, DEFAULT_APP_STATIC_PATH);
    }

    public static String getAppBasePackage() {
        return PropertiesUtil.getStringProperty(CONFIG_PROPS, ConfigConstant.APP_BASE_PACKAGE);
    }
}
